import React, { lazy } from 'react';
import { createBrowserRouter, RouterProvider, Navigate } from 'react-router-dom';

// 懒加载页面组件
const App = lazy(() => import('../app/app'));
const Login = lazy(() => import('../components/Login'));
const Register = lazy(() => import('../components/Register'));
const AuditLogPage = lazy(() => import('../pages/AuditLogPage'));
const NotFoundPage = lazy(() => import('../components/NotFoundPage'));

const router: any = createBrowserRouter([
  { path: '/app/*', element: <App /> },
  { path: '/login', element: <Login /> },
  { path: '/register', element: <Register /> },
  { path: '/audit-logs/*', element: <AuditLogPage /> },
  { path: '/', element: <Navigate to="/app" /> },
  { path: '*', element: <NotFoundPage /> },
]);

export default router;